home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / OrganicLookAndFeel.java < prev    next >
Text File  |  1998-06-30  |  34KB  |  670 lines

  1. /*
  2.  * @(#)OrganicLookAndFeel.java    1.23 98/02/17
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.organic;
  22.  
  23. import java.awt.Font;
  24. import java.awt.Color;
  25. import java.awt.SystemColor;
  26.  
  27. import com.sun.java.swing.UIDefaults;
  28. import com.sun.java.swing.LookAndFeel;
  29. import com.sun.java.swing.plaf.*;
  30. import com.sun.java.swing.plaf.basic.*;
  31. import com.sun.java.swing.border.*;
  32. import com.sun.java.swing.BorderFactory;
  33. import com.sun.java.swing.JComponent;
  34. import com.sun.java.swing.ImageIcon;
  35.  
  36.  
  37. /**
  38.  * This class is used to define the UI classes and colors which 
  39.  * define the Java Look & Feel.
  40.  * <p>
  41.  * For the keyboard keys defined for each component in this Look and
  42.  * Feel (L&F), see 
  43.  * <a href="../../doc-files/Key-Metal.html">Component Keystroke Actions for the Metal L&F</a>.
  44.  * The keystrokes for Organic are same as for Metal. The only difference is that the Organic
  45.  * combo box does not implement the Spacebar to toggle the menu up and down.
  46.  * <p>
  47.  * Warning: serialized objects of this class will not be compatible with
  48.  * future swing releases.  The current serialization support is appropriate
  49.  * for short term storage or RMI between Swing1.0 applications.  It will
  50.  * not be possible to load serialized Swing1.0 objects with future releases
  51.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  52.  * baseline for the serialized form of Swing objects.
  53.  *
  54.  * @version 1.23 02/17/98
  55.  * @author Steve Wilson
  56.  */
  57. public class OrganicLookAndFeel extends BasicLookAndFeel
  58.  
  59. {
  60.  
  61.     private static OrganicTheme currentTheme = new OrganicDefaultTheme();
  62.  
  63.     public String getName() {
  64.         return "Organic Look and Feel";
  65.     }
  66.  
  67.  
  68.     public String getID() {
  69.         return "Organic";
  70.     }
  71.  
  72.  
  73.     public String getDescription() {
  74.         return "Organic - A Cross-Platform Java Look and Feel";
  75.     }
  76.  
  77.     public boolean isNativeLookAndFeel(){
  78.         return false;
  79.     }
  80.  
  81.     public boolean isSupportedLookAndFeel() {
  82.         return true;
  83.     }
  84.  
  85.     public static void installColorsAndFont(JComponent c,
  86.                                          String defaultBgName,
  87.                                          String defaultFgName,
  88.                                          String defaultFontName) {
  89.         LookAndFeel.installColorsAndFont(c, defaultBgName, defaultFgName, defaultFontName);
  90.     }
  91.  
  92.    /** 
  93.      * Initialize the uiClassID to BasicComponentUI mapping.
  94.      * The JComponent classes define their own uiClassID constants
  95.      * (see AbstractComponent.getUIClassID).  This table must
  96.      * map those constants to a BasicComponentUI class of the
  97.      * appropriate type.
  98.      * 
  99.      * @see #getDefaults
  100.      */
  101.     protected void initClassDefaults(UIDefaults table)
  102.     {
  103.         
  104.         String basicPackageName = "com.sun.java.swing.plaf.basic.";
  105.         String organicPackageName = "com.sun.java.swing.plaf.organic.";
  106.         Object[] uiDefaults = {
  107.                    "ButtonUI", organicPackageName + "OrganicButtonUI",
  108.                  "CheckBoxUI", organicPackageName + "OrganicCheckBoxUI",
  109.              "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
  110.                   "MenuBarUI", organicPackageName + "OrganicMenuBarUI",
  111.                      "MenuUI", organicPackageName + "OrganicMenuUI",
  112.                  "MenuItemUI", organicPackageName + "OrganicMenuItemUI",
  113.          "CheckBoxMenuItemUI", organicPackageName + "OrganicCheckBoxMenuItemUI",
  114.       "RadioButtonMenuItemUI", organicPackageName + "OrganicRadioButtonMenuItemUI",
  115.               "RadioButtonUI", organicPackageName + "OrganicRadioButtonUI",
  116.              "ToggleButtonUI", organicPackageName + "OrganicToggleButtonUI",
  117.                 "PopupMenuUI", organicPackageName + "OrganicPopupMenuUI",
  118.               "ProgressBarUI", organicPackageName + "OrganicProgressBarUI",
  119.                 "ScrollBarUI", organicPackageName + "OrganicScrollBarUI",
  120.                "ScrollPaneUI", organicPackageName + "OrganicScrollPaneUI",
  121.                 "SplitPaneUI", organicPackageName + "OrganicSplitPaneUI",
  122.                    "SliderUI", organicPackageName + "OrganicSliderUI",
  123.                   "SpinnerUI", organicPackageName + "OrganicSpinnerUI",
  124.                 "SeparatorUI", organicPackageName + "OrganicSeparatorUI",
  125.                "TabbedPaneUI", organicPackageName + "OrganicTabbedPaneUI",
  126.                    "TextAreaUI", basicPackageName + "BasicTextAreaUI",  //don't need
  127.                 "TextFieldUI", organicPackageName + "OrganicTextFieldUI",
  128.             "PasswordFieldUI", organicPackageName + "OrganicPasswordFieldUI",
  129.                    "TextPaneUI", basicPackageName + "BasicTextPaneUI",  // don't need
  130.                "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
  131.                      "TreeUI", organicPackageName + "OrganicTreeUI",
  132.                     "LabelUI", organicPackageName + "OrganicLabelUI",
  133.                    "ListUI", basicPackageName + "BasicListUI",  // don't need
  134.                   "ToolBarUI", organicPackageName + "OrganicToolBarUI",
  135.                   "ToolTipUI", organicPackageName + "OrganicToolTipUI",
  136.                  "ComboBoxUI", organicPackageName + "OrganicComboBoxUI",
  137.                     "TableUI", organicPackageName + "OrganicTableUI",
  138.               "TableHeaderUI", organicPackageName + "OrganicTableHeaderUI",
  139.             "InternalFrameUI", organicPackageName + "OrganicInternalFrameUI",
  140.            "StandardDialogUI", basicPackageName + "BasicStandardDialogUI",
  141.               "DesktopPaneUI", organicPackageName + "OrganicDesktopPaneUI",
  142.               "DesktopIconUI", organicPackageName + "OrganicDesktopIconUI",
  143.             "DirectoryPaneUI", organicPackageName + "OrganicDirectoryPaneUI",
  144.               "FileChooserUI", organicPackageName + "OrganicFileChooserUI",
  145.                "OptionPaneUI", organicPackageName + "OrganicOptionPaneUI"
  146.         };
  147.  
  148.         table.putDefaults(uiDefaults);
  149.     }
  150.  
  151.  
  152.     /**
  153.      * Load the SystemColors into the defaults table.  The keys
  154.      * for SystemColor defaults are the same as the names of
  155.      * the public fields in SystemColor.
  156.      */
  157.     protected void initSystemColorDefaults(UIDefaults table)
  158.     {
  159.         Object[] systemColors = {
  160.                       "desktop", getDesktopColor(),
  161.                 "activeCaption", getWindowTitleBackground(),
  162.             "activeCaptionText", getWindowTitleForeground(),
  163.           "activeCaptionBorder", getControl1(),
  164.               "inactiveCaption", getWindowTitleInactiveBackground(),
  165.           "inactiveCaptionText", getWindowTitleInactiveForeground(),
  166.         "inactiveCaptionBorder", getInactiveSystemTextColor(),
  167.                        "window", getWindowBackground(),
  168.                  "windowBorder", getBlack(),
  169.                    "windowText", getWindowBackground(),
  170.                          "menu", getMenuBackground(),
  171.                      "menuText", getMenuForeground(),
  172.                          "text", getControl1(),
  173.                      "textText", getUserTextColor(),
  174.                 "textHighlight", getTextHighlightColor(),
  175.             "textHighlightText", getHighlightedTextColor(),
  176.              "textInactiveText", getInactiveSystemTextColor(),
  177.                       "control", getControl1(),
  178.                   "controlText", getControlTextColor(),
  179.              "controlHighlight", getLightAccent1(),
  180.            "controlLtHighlight", getLightAccent1(), 
  181.                 "controlShadow", getControl2(),
  182.               "controlDkShadow", getControl3(),
  183.                     "scrollbar", getWindowBackground(),
  184.                          "info", getHighlight4(),
  185.                      "infoText", getWindowBackground() 
  186.         };
  187.  
  188.         for(int i = 0; i < systemColors.length; i += 2) {
  189.             table.put((String)systemColors[i], systemColors[i + 1]);
  190.         }
  191.     }
  192.  
  193.     protected void initComponentDefaults(UIDefaults table) 
  194.     {
  195.  
  196.  
  197.         FontUIResource monospacedPlain12 = new FontUIResource("Monospaced", 
  198.                                                           Font.PLAIN, 12);
  199.  
  200.  
  201.         Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
  202.             public Object createValue(UIDefaults table) { 
  203.                 return new BasicListCellRenderer.UIResource();
  204.             }
  205.         };
  206.  
  207.         Object scrollPaneBorder =  BorderUIResource.getEtchedBorderUIResource();
  208.  
  209.         Object multilineTextBorder =  BasicMarginBorder.getMarginBorder();
  210.  
  211.         Object fieldTextBorder = new BorderUIResource( new OrganicTextBorder(getControl1()));
  212.  
  213.         Object activeFieldTextBorder = new BorderUIResource( new OrganicTextBorder(getWindowBackground()));
  214.  
  215.         Object toolTipBorder =new BorderUIResource(BorderFactory.createLineBorder(getWindowBackground(), 1));
  216.                                    
  217.         Object caretBlinkRate = new Integer(500);
  218.  
  219.         Object buttonBorder = new BorderUIResource( new CompoundBorder(
  220.                                          new OrganicButtonBorder(),
  221.                                          new OrganicButtonUI.OrganicButtonMargin()));
  222.  
  223.         Object buttonToggleBorder = new BorderUIResource( new CompoundBorder( 
  224.                                          new OrganicToggleButtonUI.OrganicToggleButtonBorder(),
  225.                                          new OrganicButtonUI.OrganicButtonMargin()));
  226.  
  227.         // *** ComboBox
  228.         Object comboBoxRendererActiveValue  = new UIDefaults.ActiveValue() {
  229.             public Object createValue(UIDefaults table) {
  230.                 return new BasicComboBoxRenderer.UIResource();
  231.             }
  232.         };
  233.  
  234.         Object comboBoxEditorActiveValue  = new UIDefaults.ActiveValue() {
  235.             public Object createValue(UIDefaults table) {
  236.                 return new OrganicComboBoxEditor.UIResource();
  237.             }
  238.         };
  239.  
  240.         Object menuItemMarginBorder = new BorderUIResource(new OrganicMenuItemBorder() );
  241.  
  242.         Object menuMarginBorder = new BorderUIResource(new OrganicMenuItemBorder() );
  243.  
  244.         Object menuBarBorder = new BorderUIResource(new OrganicMenuBarBorder());
  245.  
  246.         Object popupMenuBorder = new BorderUIResource(new OrganicPopupMenuBorder());
  247.  
  248.         Object titledBorderBorder = new BorderUIResource(new LineBorder(table.getColor("controlHighlight")));
  249.  
  250.         Object menuItemCheckIcon = OrganicIconFactory.getMenuItemCheckIcon();
  251.  
  252.         Object menuItemArrowIcon =  OrganicIconFactory.getMenuItemArrowIcon();
  253.  
  254.         Object menuArrowIcon = OrganicIconFactory.getMenuArrowIcon();
  255.  
  256.         Object checkBoxIcon = new OrganicCheckBoxIcon();
  257.  
  258.         Object radioButtonIcon = OrganicIconFactory.getRadioButtonIcon();
  259.  
  260.         Object checkBoxMenuItemIcon = OrganicIconFactory.getCheckBoxMenuItemIcon();
  261.  
  262.         Object radioButtonMenuItemIcon =  OrganicIconFactory.getRadioButtonMenuItemIcon();
  263.  
  264.         Object toolBarBorder = new BorderUIResource( new OrganicMenuBarBorder() );
  265.  
  266.         Object treeNodeClosedIcon =  OrganicIconFactory.getTreeNodeClosedIcon();
  267.  
  268.         Object treeNodeOpenIcon =  OrganicIconFactory.getTreeNodeOpenIcon();
  269.  
  270.         Object treeNodeLeafIcon = OrganicIconFactory.getTreeNodeLeafIcon();
  271.  
  272.         Object treeComputerIcon =  OrganicIconFactory.getTreeComputerIcon();
  273.  
  274.         Object treeHardDriveIcon = OrganicIconFactory.getTreeHardDriveIcon();
  275.  
  276.         Object treeFloppyDriveIcon = OrganicIconFactory.getTreeFloppyDriveIcon();
  277.  
  278.         Object treeExpandCollapseIcon = new OrganicTreeUI.ExpandCollapseIcon();
  279.  
  280.         Object fileChooserNewFolderIcon = OrganicIconFactory.getFileChooserNewFolderIcon();
  281.  
  282.         Object fileChooserUpFolderIcon =  OrganicIconFactory.getFileChooserUpFolderIcon();
  283.  
  284.         Object fileChooserHomeFolderIcon =  OrganicIconFactory.getFileChooserHomeFolderIcon();
  285.  
  286.         Object fileChooserDetailsViewIcon = OrganicIconFactory.getFileChooserDetailsViewIcon();
  287.  
  288.         Object fileChooserListViewIcon = OrganicIconFactory.getFileChooserListViewIcon();
  289.  
  290.         Object optionPaneBorder = new BorderUIResource( new CompoundBorder( 
  291.                                              new MatteBorder( 2, 2, 2, 2, table.getColor("controlDkShadow") ),
  292.                                              new EmptyBorder( 1, 1, 1, 1 ) ));
  293.  
  294.         Object listBorder = new BorderUIResource( new EmptyBorder( 6, 6, 6, 6 ));
  295.  
  296.  
  297.         Object internalFrameBorder = new BorderUIResource( new CompoundBorder(
  298.                                          BorderFactory.createLineBorder(getLightAccent1(), 1),
  299.                                          new OrganicFrameBorder( getWindowFrameLeft(),
  300.                                                                  getWindowFrameRight(),
  301.                                                                  getWindowFrameTop(),
  302.                                                                  getWindowFrameBottom(),
  303.                                                                  getWindowFrameInactive(),
  304.                                                                  2)) );
  305.  
  306.         Object internalPaletteFrameBorder = new BorderUIResource(
  307.                                             new MatteBorder (2, 2, 2, 2, getHighlight4() ));
  308.  
  309.         Object focusCellHighlightBorder = new BorderUIResource( new LineBorder(getHighlight4()) );
  310.  
  311.         Object[] defaults = {
  312.             "Desktop.background", table.get("desktop"),
  313.  
  314.             "Panel.background", table.get("control"),
  315.             "Panel.foreground", table.get("textText"),
  316.             "Panel.font", getControlTextFont(),
  317.  
  318.             "Button.border", buttonBorder,
  319.             "Button.background", table.get("control"),
  320.             "Button.foreground", table.get("controlText"),
  321.             "Button.focus", getFocusColor(),
  322.             "Button.pressed",  table.get("controlShadow"),
  323.             "Button.disabled", table.get("controlShadow"),  
  324.             "Button.disabledText", table.get("textInactiveText"),          
  325.             "Button.font", getControlTextFont(),
  326.             "Button.highlight", table.get("controlLtHighlight"),
  327.             "Button.shadow", table.get("controlDkShadow"),
  328.  
  329.             "ToggleButton.border", buttonToggleBorder,
  330.             "ToggleButton.background", table.get("control"),
  331.             "ToggleButton.foreground", table.get("controlText"),
  332.             "ToggleButton.focus", getFocusColor(),
  333.             "ToggleButton.focusHighlight", getLightAccent1(),
  334.             "ToggleButton.selected",   table.get("controlShadow"),
  335.             "ToggleButton.disabled",   table.get("controlShadow"),  
  336.             "ToggleButton.disabledText", table.get("textInactiveText"),  
  337.             "ToggleButton.font", getControlTextFont(),
  338.  
  339.             "InternalFrame.icon", null,
  340.             "InternalFrame.border", internalFrameBorder,
  341.             "InternalFrame.paletteBorder", internalPaletteFrameBorder,      
  342.  
  343.             "InternalFrameTitlePane.activeBackground", table.get("activeCaption"),          
  344.             "InternalFrameTitlePane.inactiveBackground", table.get("inactiveCaption"),
  345.             "InternalFrameTitlePane.activeForeground",  table.get("activeCaptionText"),
  346.             "InternalFrameTitlePane.inactiveForeground",table.get("inactiveCaptionText"),
  347.             "InternalFrameTitlePane.paletteBackground", getPaletteTitleBackground(),        
  348.             "InternalFrameTitlePane.paletteForeground", getPaletteTitleForeground(),      
  349.             "InternalFrameTitlePane.font", getEmphasisTextFont(),
  350.             "InternalFrameTitlePane.maximizeIcon", OrganicIconFactory.createFrameMaximizeIcon(),
  351.             "InternalFrameTitlePane.iconizeIcon",  OrganicIconFactory.createFrameIconifyIcon(),
  352.             "InternalFrameTitlePane.closeIcon",  OrganicIconFactory.createFrameCloseIcon(),
  353.             "InternalFrameTitlePane.altMaximizeIcon", OrganicIconFactory.createFrameMinimizeIcon(),
  354.            
  355.             "RadioButton.background",  table.get("control"),
  356.             "RadioButton.foreground", table.get("controlText"),
  357.             "RadioButton.shadow", table.get("controlShadow"),
  358.             "RadioButton.darkShadow", table.get("controlDkShadow"),
  359.             "RadioButton.highlight", table.get("controlHighlight"),
  360.             "RadioButton.lightHighlight", getWhite(),
  361.             "RadioButton.dot", getBlack(),
  362.             "RadioButton.focus", getFocusColor(),
  363.             "RadioButton.font", getControlTextFont(),
  364.             "RadioButton.icon", radioButtonIcon,
  365.  
  366.             "CheckBox.icon", checkBoxIcon,
  367.  
  368.             "RadioButtonMenuItem.icon", radioButtonMenuItemIcon,
  369.             "CheckBoxMenuItem.icon", checkBoxMenuItemIcon,
  370.  
  371.             "Menu.border", menuMarginBorder,
  372.             "Menu.font", getMenuTextFont(),
  373.             "Menu.foreground", getMenuForeground(),
  374.             "Menu.pressedForeground", getMenuSelectedForeground(),
  375.             "Menu.subMenuForeground", getMenuItemForeground(),
  376.             "Menu.arrowIcon", menuArrowIcon,
  377.  
  378.             "MenuBar.border", menuBarBorder,
  379.             "MenuBar.background", table.get("menu"),
  380.             "MenuBar.foreground", table.get("menuText"),
  381.             "MenuBar.font", getMenuTextFont(),
  382.  
  383.             "MenuItem.border", menuItemMarginBorder,
  384.             "MenuItem.borderPainted", Boolean.FALSE,
  385.             "MenuItem.font", getMenuTextFont(),
  386.             "MenuItem.foreground", getMenuItemForeground(),
  387.             "MenuItem.disabledForeground", table.get("controlDkShadow"),
  388.             "MenuItem.background", table.get("menu"),
  389.             "MenuItem.pressedForeground", getMenuSelectedForeground(),
  390.             "MenuItem.pressedBackground", getMenuSelectedBackground(),
  391.             "MenuItem.acceleratorFont", getMenuTextFont(),
  392.             "MenuItem.acceleratorForeground", getMenuItemForeground(),
  393.             "MenuItem.acceleratorPressedForeground", getMenuSelectedForeground(),
  394.             "MenuItem.checkIcon", menuItemCheckIcon,
  395.             "MenuItem.arrowIcon", menuItemArrowIcon,
  396.  
  397.             "Separator.background", getMenuBackground(),
  398.             "Separator.foreground", getMenuSelectedBackground(),
  399.  
  400.             "PopupMenu.background", table.get("menu"),
  401.             "PopupMenu.border", popupMenuBorder,          
  402.  
  403.             "ComboBox.renderer", comboBoxRendererActiveValue,
  404.             "ComboBox.editor", comboBoxEditorActiveValue,
  405.             "ComboBox.background", table.get("control"),
  406.             "ComboBox.foreground", table.get("controlText"),
  407.             "ComboBox.selectedBackground", table.get("controlHighlight"),
  408.             "ComboBox.selectedForeground", table.get("controlText"),
  409.             "ComboBox.listBackground", table.get("control"),
  410.             "ComboBox.listForeground", table.get("controlText"),
  411.             "ComboBox.font", getControlTextFont(),
  412.  
  413.             "Label.font", getControlTextFont(),
  414.             "Label.background", table.get("text"),
  415.             "Label.foreground", getSystemTextColor(),
  416.             "Label.disabled", table.get("controlDkShadow"),
  417.  
  418.             "List.background", table.get("window"),
  419.             "List.foreground", table.get("controlText"),
  420.             "List.selectionBackground", table.get("control"), 
  421.             "List.selectionForeground", table.get("controlText"),
  422.             "List.focusCellHighlightBorder", focusCellHighlightBorder,
  423.             "List.font", getControlTextFont(),
  424.             "List.cellRenderer", listCellRendererActiveValue,
  425.             "List.border", listBorder,
  426.  
  427.             "TextField.caretForeground", getBlack(),
  428.             "TextField.caretBlinkRate", caretBlinkRate,
  429.             "TextField.inactiveForeground", table.get("textInactiveText"),
  430.             "TextField.selectionBackground", table.get("textHighlight"),
  431.             "TextField.selectionForeground", table.get("textHighlightText"),
  432.             "TextField.background", table.get("text"),
  433.             "TextField.foreground", table.get("textText"),
  434.             "TextField.font", getUserTextFont(),
  435.             "TextField.border", fieldTextBorder,
  436.             "TextField.activeBorder", activeFieldTextBorder,
  437.             "TextField.activeBackground", table.get("textHighlightText"),
  438.             
  439.             "ToolBar.border", toolBarBorder,
  440.             "ToolBar.background", table.get("menu"),
  441.             "ToolBar.foreground", table.get("menuText"),
  442.             "ToolBar.font", getControlTextFont(),
  443.  
  444.             "PasswordField.caretForeground", getBlack(),
  445.             "PasswordField.caretBlinkRate", caretBlinkRate,
  446.             "PasswordField.inactiveForeground", table.get("textInactiveText"),
  447.             "PasswordField.selectionBackground", table.get("textHighlight"),
  448.             "PasswordField.selectionForeground", table.get("textHighlightText"),
  449.             "PasswordField.background",  table.get("text"),
  450.             "PasswordField.foreground", table.get("textText"),
  451.             "PasswordField.font", monospacedPlain12,
  452.             "PasswordField.border", fieldTextBorder,
  453.             "PasswordField.activeBorder", activeFieldTextBorder,
  454.             "PasswordField.activeBackground", table.get("textHighlightText"),
  455.  
  456.             "ProgressBar.font", getControlTextFont(),
  457.             "ProgressBar.head", getLightAccent4(),
  458.             "ProgressBar.foreground",  getBlack(), 
  459.             "ProgressBar.background", table.get("controlShadow"),
  460.  
  461.             "SplitPane.background", table.get("control"),
  462.             "SplitPane.highlight", table.get("controlLtHighlight"),
  463.             "SplitPane.shadow", table.get("controlLtHighlight"),
  464.  
  465.             "TabbedPane.font", getControlTextFont(),
  466.             "TabbedPane.tabBackground", table.get("controlShadow"),
  467.             "TabbedPane.tabForeground", getControlTextColor(),
  468.             "TabbedPane.tabHighlight", table.get("controlHighlight"),
  469.             "TabbedPane.tabShadow", table.get("controlShadow"),
  470.             "TabbedPane.tabDarkShadow", table.get("controlDkShadow"),
  471.             "TabbedPane.focus", getFocusColor(),
  472.             "TabbedPane.selected", table.get("control"),
  473.             
  474.             "TextArea.caretForeground", getBlack(),
  475.             "TextArea.caretBlinkRate", caretBlinkRate,
  476.             "TextArea.inactiveForeground", table.get("textInactiveText"),
  477.             "TextArea.selectionBackground", table.get("textHighlight"),
  478.             "TextArea.selectionForeground", table.get("textHighlightText"),
  479.             "TextArea.background", table.get("window"),
  480.             "TextArea.foreground", table.get("textText"),
  481.             "TextArea.font", getUserTextFont(),
  482.             "TextArea.border", multilineTextBorder,
  483.             
  484.             "TextPane.caretForeground", getBlack(),
  485.             "TextPane.inactiveForeground", table.get("textInactiveText"),
  486.             "TextPane.selectionBackground",  table.get("textHighlight"),
  487.             "TextPane.selectionForeground", table.get("textHighlightText"),
  488.             "TextPane.background", table.get("window"),
  489.             "TextPane.foreground", table.get("textText"),
  490.             "TextPane.font", getUserTextFont(),
  491.             "TextPane.border", multilineTextBorder,
  492.             
  493.             "EditorPane.caretForeground", getBlack(),
  494.             "EditorPane.inactiveForeground", table.get("textInactiveText"),
  495.             "EditorPane.selectionBackground",  table.get("textHighlight"),
  496.             "EditorPane.selectionForeground", table.get("textHighlightText"),
  497.             "EditorPane.background", table.get("window"),
  498.             "EditorPane.foreground", table.get("textText"),
  499.             "EditorPane.font", getUserTextFont(),
  500.             "EditorPane.border", multilineTextBorder,
  501.             
  502.             "ScrollBar.background", table.get("scrollbar"),
  503.             "ScrollBar.track", table.get("scrollbar"),
  504.             "ScrollBar.trackHighlight", table.get("control"),
  505.             "ScrollBar.thumb", table.get("controlShadow"),
  506.             "ScrollBar.thumbHighlight", getDarkAccent4(),
  507.             "ScrollBar.border", null,
  508.             "ScrollBar.width", new Integer ( 9 ),
  509.  
  510.             "ScrollPane.border", null,
  511.             "ScrollPane.font", getControlTextFont(),
  512.             "ScrollPane.background", table.get("window"),
  513.             "ScrollPane.foreground", table.get("textText"),
  514.             "ScrollPane.viewportBorder", null,
  515.  
  516.             "Slider.border", null,
  517.             "Slider.foreground", table.get("controlShadow"),
  518.             "Slider.background", table.get("control"),
  519.             "Slider.highlight", table.get("controlLtHighlight"),
  520.             "Slider.darkShadow", table.get("controlDkShadow"),
  521.             "Slider.thumb", getDarkAccent4(),
  522.             "Slider.focus", getFocusColor(),
  523.  
  524.             "TitledBorder.font", getControlTextFont(),
  525.             "TitledBorder.titleColor", getSystemTextColor(),
  526.             "TitledBorder.border", titledBorderBorder,
  527.  
  528.             "ToolTip.font", getUserTextFont(),
  529.             "ToolTip.border", toolTipBorder,
  530.             "ToolTip.background", table.get("info"),
  531.             "ToolTip.foreground", table.get("infoText"),
  532.  
  533.             "Tree.background", table.get("window"),
  534.             "Tree.hash", table.get("control"),
  535.             "Tree.textSelectionColor", table.get("textHighlightText"),
  536.             "Tree.textNonSelectionColor", table.get("textText"),
  537.             "Tree.borderSelectionColor", table.get("controlShadow"),
  538.             "Tree.backgroundSelectionColor", table.get("textHighlight"),
  539.             "Tree.backgroundNonSelectionColor", table.get("window"),
  540.             "Tree.knobColor", getLightAccent4(),
  541.             "Tree.openIcon", treeNodeOpenIcon,
  542.             "Tree.closedIcon", treeNodeClosedIcon,
  543.             "Tree.leafIcon", treeNodeLeafIcon,
  544.             "Tree.computer", treeComputerIcon,
  545.             "Tree.hardDrive", treeHardDriveIcon,
  546.             "Tree.floppyDrive", treeFloppyDriveIcon,
  547.             "Tree.expandedIcon", treeExpandCollapseIcon,
  548.             "Tree.collapsedIcon", treeExpandCollapseIcon,
  549.  
  550.             "Table.font", getUserTextFont(),
  551.             "Table.foreground", table.get("textText"),  // cell text color
  552.             "Table.background", table.get("controlLtHighlight"),  // cell background color
  553.             "Table.selectionForeground", table.get("textText"),
  554.             "Table.selectionBackground", table.get("controlShadow"),
  555.             "Table.gridColor", getHighlight1(),  // grid line color
  556.             "Table.focusCellHighlightBorder", focusCellHighlightBorder,
  557.             "Table.scrollPaneBorder", null,
  558.  
  559.             "TableHeader.font", getUserTextFont(), 
  560.             "TableHeader.foreground", getSystemTextColor(), // header text color
  561.             "TableHeader.background", table.get("control"), // header background
  562.  
  563.  
  564.             "FileChooser.newFolder", fileChooserNewFolderIcon,
  565.             "FileChooser.upFolder", fileChooserUpFolderIcon,
  566.             "FileChooser.homeFolder", fileChooserHomeFolderIcon,
  567.             "FileChooser.detailsView", fileChooserDetailsViewIcon,
  568.             "FileChooser.listView", fileChooserListViewIcon,
  569.  
  570.             "DirectoryPane.directoryIcon", treeNodeClosedIcon,
  571.             "DirectoryPane.fileIcon", treeNodeLeafIcon,
  572.             "DirectoryPane.computerIcon", treeComputerIcon,
  573.             "DirectoryPane.hardDriveIcon", treeHardDriveIcon,
  574.             "DirectoryPane.floppyDriveIcon", treeFloppyDriveIcon,
  575.  
  576.             "OptionPane.font", getControlTextFont(),
  577.             "OptionPane.background", table.get("control"),
  578.             "OptionPane.foreground", table.get("textText"),
  579.             "OptionPane.border", optionPaneBorder,          
  580.             "OptionPane.shadow", table.get("controlShadow"),
  581.             "OptionPane.darkShadow", table.get("controlDkShadow"),                  
  582.             "OptionPane.errorIcon", LookAndFeel.makeIcon(getClass(), "icons/Error.gif"),
  583.             "OptionPane.informationIcon", LookAndFeel.makeIcon(getClass(), "icons/Inform.gif"),
  584.             "OptionPane.warningIcon", LookAndFeel.makeIcon(getClass(), "icons/Warn.gif"),
  585.             "OptionPane.questionIcon", LookAndFeel.makeIcon(getClass(), "icons/Question.gif")
  586.         };
  587.  
  588.         table.putDefaults(defaults);
  589.     }
  590.     public UIDefaults getDefaults() {
  591.         UIDefaults table = new UIDefaults();
  592.  
  593.         initClassDefaults(table);
  594.         initSystemColorDefaults(table);
  595.         initComponentDefaults(table);
  596.         currentTheme.addCustomEntriesToTable(table);
  597.         return table;
  598.     }
  599.     
  600.  
  601.  
  602.     public static void setCurrentTheme(OrganicTheme theme) {
  603.         if (theme == null) {
  604.             throw new NullPointerException("Can't have null theme");
  605.         }
  606.         currentTheme = theme;
  607.     }
  608.  
  609.     public static ColorUIResource getControl1() { return currentTheme.getControl1(); }
  610.     public static ColorUIResource getControl2() { return currentTheme.getControl2(); }
  611.     public static ColorUIResource getControl3() { return currentTheme.getControl3(); }
  612.     public static ColorUIResource getControl4() { return currentTheme.getControl4(); }
  613.  
  614.     public static ColorUIResource getHighlight1() { return currentTheme.getHighlight1(); }
  615.     public static ColorUIResource getHighlight2() { return currentTheme.getHighlight2(); }
  616.     public static ColorUIResource getHighlight3() { return currentTheme.getHighlight3(); }
  617.     public static ColorUIResource getHighlight4() { return currentTheme.getHighlight4(); }
  618.  
  619.     public static ColorUIResource getDarkAccent1() { return currentTheme.getDarkAccent1(); }
  620.     public static ColorUIResource getDarkAccent2() { return currentTheme.getDarkAccent2(); }
  621.     public static ColorUIResource getDarkAccent3() { return currentTheme.getDarkAccent3(); }
  622.     public static ColorUIResource getDarkAccent4() { return currentTheme.getDarkAccent4(); }
  623.  
  624.     public static ColorUIResource getLightAccent1() { return currentTheme.getLightAccent1(); }
  625.     public static ColorUIResource getLightAccent2() { return currentTheme.getLightAccent2(); }
  626.     public static ColorUIResource getLightAccent3() { return currentTheme.getLightAccent3(); }
  627.     public static ColorUIResource getLightAccent4() { return currentTheme.getLightAccent4(); }
  628.  
  629.     public static ColorUIResource getWhite() { return currentTheme.getWhite(); } 
  630.     public static ColorUIResource getBlack() { return currentTheme.getBlack(); }
  631.  
  632.     public static FontUIResource getControlTextFont() { return currentTheme.getControlTextFont();}
  633.     public static FontUIResource getUserTextFont() { return currentTheme.getUserTextFont();}
  634.     public static FontUIResource getMenuTextFont() { return currentTheme.getMenuTextFont();}
  635.     public static FontUIResource getEmphasisTextFont() { return currentTheme.getEmphasisTextFont();}
  636.  
  637.     public static ColorUIResource getDesktopColor() { return currentTheme.getDesktopColor(); }
  638.     public static ColorUIResource getFocusColor() { return currentTheme.getFocusColor(); }
  639.  
  640.  
  641.     public static ColorUIResource getSystemTextColor() { return currentTheme.getSystemTextColor(); }
  642.     public static ColorUIResource getControlTextColor() { return currentTheme.getControlTextColor(); }  
  643.     public static ColorUIResource getInactiveSystemTextColor() { return currentTheme.getInactiveSystemTextColor(); }
  644.     public static ColorUIResource getUserTextColor() { return currentTheme.getUserTextColor(); }
  645.     public static ColorUIResource getTextHighlightColor() { return currentTheme.getTextHighlightColor(); }
  646.     public static ColorUIResource getHighlightedTextColor() { return currentTheme.getHighlightedTextColor(); }
  647.  
  648.     public static ColorUIResource getWindowBackground() { return currentTheme.getWindowBackground(); }
  649.     public static ColorUIResource getWindowTitleBackground() { return currentTheme.getWindowTitleBackground(); }  
  650.     public static ColorUIResource getWindowTitleInactiveBackground() { return currentTheme.getWindowTitleInactiveBackground(); }
  651.     public static ColorUIResource getWindowTitleInactiveForeground() { return currentTheme.getWindowTitleInactiveForeground(); }
  652.     public static ColorUIResource getWindowTitleForeground() { return currentTheme.getWindowTitleForeground(); }
  653.     public static ColorUIResource getPaletteTitleBackground() { return currentTheme.getPaletteTitleBackground(); }
  654.     public static ColorUIResource getPaletteTitleForeground() { return currentTheme.getPaletteTitleForeground(); }
  655.     public static ColorUIResource getWindowFrameTop() { return currentTheme.getWindowFrameTop(); }   
  656.     public static ColorUIResource getWindowFrameBottom() { return currentTheme.getWindowFrameBottom(); }   
  657.     public static ColorUIResource getWindowFrameRight() { return currentTheme.getWindowFrameRight(); }   
  658.     public static ColorUIResource getWindowFrameLeft() { return currentTheme.getWindowFrameLeft(); }   
  659.     public static ColorUIResource getWindowFrameInactive() { return currentTheme.getWindowFrameInactive(); }   
  660.  
  661.     public static ColorUIResource getMenuBackground() { return currentTheme.getMenuBackground(); }
  662.     public static ColorUIResource getMenuForeground() { return  currentTheme.getMenuForeground(); }
  663.     public static ColorUIResource getMenuSelectedBackground() { return currentTheme.getMenuSelectedBackground(); }
  664.     public static ColorUIResource getMenuSelectedForeground() { return currentTheme.getMenuSelectedForeground(); }
  665.     public static ColorUIResource getMenuItemForeground() { return  currentTheme.getMenuItemForeground(); }
  666.     public static ColorUIResource getMenuItemSelectedForeground() { return  currentTheme.getMenuItemSelectedForeground(); }
  667.  
  668. }
  669.     
  670.